<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

class ActivityValidate extends Validate
{
    protected $rule = [
        'id'            => 'require|number',
        'title'         => 'require',
        'thumbnail'     => 'require',
        'start_time'    => 'require|date',
        'end_time'      => 'require|date',
        'content'       => 'require',
    ];
    protected $message = [
        'id.require'           => 'id不能为空',
        'id.number'            => 'id必须为数字',
        'title.require'        => '标题不能为空',
        'thumbnail.require'    => '封面图不能为空',
        'start_time.require'   => '开始时间不能为空',
        'start_time.date'      => '开始时间格式不正确',
        'end_time.require'     => '结束时间不能为空',
        'end_time.date'        => '结束时间格式不正确',
        'content.require'      => '内容不能为空',
    ];

    protected $scene = [
        'add'  => ['title','thumbnail','start_time','end_time','content'],
        'edit' => ['id','title','thumbnail','start_time','end_time','content'],
    ];
}